<?php
/**
 * Created by PhpStorm.
 * User: huangpeng3
 * Date: 2018/1/31
 * Time: 下午4:03
 */
namespace Home\Controller;

use Think\Controller;

class MandatoryController extends Controller
{

    public function listAll()
    {
        $rst = array();
        if (!empty($_SESSION['user_info']['id'])) {
            $uid = intval($_SESSION['user_info']['id']);
            $m = D('Mandatory');
            $flag = $m->getAll($uid);
            if ($flag != -1) {
                $rst['status'] = true;
                $rst['info'] = '查询成功';
                $rst['data'] = $flag;
            } else {
                $rst['status'] = false;
                $rst['info'] = '查询失败';
                $rst['flag'] = C('COMMON_ERROR');
            }
        } else {
            $rst['status'] = false;
            $rst['info'] = '未登录';
            $rst['flag'] = C('UNLOGIN_ERROR');
        }
        echo json_encode($rst, JSON_UNESCAPED_UNICODE);
    }
}